﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Quizz.Infrastructure.Models
{
    public class ErrorReportResult : IDisposable
    {
        #region Fields

        #endregion

        #region Properties

        public IList<string> Errors { get; set; }

        #endregion

        #region Methods

        public ErrorReportResult()
        {
            Errors = new List<string>();
        }

        public void AddError(string error)
        {
            Errors.Add(error);
        }

        public override string ToString()
        {
            return ToString();
        }

        public string ToString(string breakLine = "\n")
        {
            var result = new StringBuilder();
            foreach (var error in Errors)
            {
                result.AppendFormat("* {0}</br>", error);
            }
            return result.ToString();
        }

        public bool HasError()
        {
            return Errors.Count > 0;
        }

        #endregion

        public void Dispose()
        {
            GC.SuppressFinalize(this);
        }
    }
}
